Skip to content

Cross build laika-sbt for sbt 2#774

Open
tanishiking wants to merge 1 commit into
typelevel:mainfrom
tanishiking:sbt2
Open

Cross build laika-sbt for sbt 2#774
tanishiking wants to merge 1 commit into
typelevel:mainfrom
tanishiking:sbt2

Conversation

@tanishiking

@tanishiking tanishiking commented Jun 25, 2026

Copy link
Copy Markdown

Depends on upstream sbt change sbt/sbt#9377, we need to wait until sbt 2.0.1 2.0.1 is released with that fix.


close #773

  • Exclude all laika-sbt tasks from sbt 2 caching with Def.uncached.
  • Adapt to sbt2 API changes using https://github.com/sbt/sbt2-compat if you don't like adding dependency, we can define small set of PluginCompat.
  • Run the plugin build and tests in CI with sbt 2, Scala 3, and Java 17.
  • Set Laika / target explicitly in each scripted project build.sbt so scripted tests work across sbt 1 and 2 target directory.

Depends on upstream sbt change sbt/sbt#9377

@tanishiking tanishiking changed the title [WIP] Cross build laika-sbt for sbt 2 Cross build laika-sbt for sbt 2 Jun 29, 2026
logLevel = MessageFilter.Warning
)

private def unapply(conf: LaikaConfig) = conf

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused, removed for suppress warning in Scala3.

Laika / clean := Tasks.clean.value,
laikaSite / mappings := Def.sequential(Tasks.site, Tasks.mappings).value
) :+ (cleanFiles += (Laika / target).value)
@nowarn("msg=unused import")

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sbtcompat.PluginCompat.* in Scala3.

fix typelevel#773

- Exclude all laika-sbt tasks from sbt 2 caching with `Def.uncached`.
- Adapt to sbt2 API changes using https://github.com/sbt/sbt2-compat
  if you don't like adding dependency, we can define small set of
  PluginCompat.
- Run the plugin build and tests in CI with sbt 2, Scala 3, and Java 17.
- Set `Laika / target` explicitly in each scripted project `build.sbt` so
  scripted tests work across sbt 1 and 2 target directory.

Depends on upstream sbt change sbt/sbt#9377
@tanishiking
tanishiking marked this pull request as ready for review June 29, 2026 08:41
@armanbilge
armanbilge self-requested a review July 1, 2026 16:57

@reardonj reardonj left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks pretty reasonable. I'm not familiar with the CI setup stuff enough to comment on it.


enablePlugins(LaikaPlugin)

Laika / target := baseDirectory.value / "target" / "docs"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this have to be added due to sbt2 changes the target directory setup?

Comment thread build.sbt
else Some(8)
},
// Scaladoc 3 cannot currently resolve some TASTy from sbt 2 transitive dependencies.
// https://github.com/scala/scala3/issues/18487

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you fixed this bug. I guess we are stuck until at least 3.9 to make use of it though?

Comment thread build.sbt
// TODO: Re-enable MiMa for sbt 2 once a previous sbt 2 plugin artifact exists.
// The sbt 2 / Scala 3 plugin artifact did not exist in previous Laika releases,
// so MiMa cannot compare against a missing baseline.
mimaPreviousArtifacts := {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't suppose there is a nicer way to do this @armanbilge ?

Seq(
Laika / sourceDirectories := Seq(sourceDirectory.value / "docs"),
Laika / excludeFilter := HiddenFileFilter,
laikaInputs := Def.uncached(Settings.defaultInputs.value),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these need to be uncached or is this just for ease of migration?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sbt 2.x support for laika-sbt

2 participants